package com.xmut.mapper;

import com.xmut.pojo.PurchaseRecord;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PurchaseRecordMapper {
@Select("select * from purchase_record where id = #{id}")
List<PurchaseRecord> GetPurchaseRecord(Integer id);
@Insert("INSERT INTO purchase_record (userId, names, prices,date)\n" +
        "VALUES (#{userId}, #{names}, #{prices}, #{date});")
void InsertPurchaseRecord(PurchaseRecord purchaseRecord);
@Select("select * from purchase_record where userId = #{userId}")
List<PurchaseRecord> getAllRecordById(Integer userId);
@Delete("delete from purchase_record where id=#{id}")
void delRecordById(Integer id);

    @Select("select * from purchase_record")
    List<PurchaseRecord> getAllRecord();
}
